package com.hzdl.house_mgr.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.house_mgr.bean.Rent;
import com.hzdl.house_mgr.mapper.HouseMapper;
import com.hzdl.house_mgr.mapper.RentMapper;
import com.hzdl.house_mgr.service.RentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RentServiceImpl implements RentService {

    @Autowired
    private RentMapper rentMapper;


    /*@Override
    public int insertRent(Rent rent) {
        int i = rentMapper.insertRent(rent);
        int j = houseMapper.updateHouseStatus(rent.getHouseId(),1);
        return i+j;
    }*/

    @Override
    public PageInfo<Rent> findAllByWhere(Rent rent, Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        List<Rent> list = rentMapper.findAllByWhere(rent);
        PageInfo<Rent> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int getCountByWhere(Rent rent) {
        return rentMapper.getCountByWhere(rent);
    }

    @Override
    public int getRent(Rent rent) {
        return rentMapper.getRent(rent);
    }


}
